package com.simple.common.entity.dto.pay;

import com.simple.common.entity.ReqContext;
import com.simple.common.entity.po.sys.*;
import lombok.Data;

import java.util.Date;
import java.util.Map;

/**
 * @author yasud
 * @date 2020年10月13日 11:35
 * @description
 */
@Data
public class CallbackDynamicRefundDto extends CallbackDto {

    /**
     * 交易
     */
    private Trade trade;

    /**
     * 退款
     */
    private RefundTrade refundTrade;

    /**
     * 退款流水
     */
    private RefundTradeInventory refundTradeInventory;

    /**
     * 提供方便方法
     *
     * @param body
     * @param requestTime
     * @param param
     * @param headers
     * @return
     */
    public static CallbackDynamicRefundDto generateCallbackDto(String body,
                                                               Map<String, Object> param,
                                                               Map<String, Object> headers,
                                                               Date requestTime,
                                                               ChannelComp channel,
                                                               ReqContext reqContext,
                                                               Product product,
                                                               Trade trade,
                                                               RefundTrade refundTrade,
                                                               RefundTradeInventory refundTradeInventory) {
        CallbackDynamicRefundDto callbackDynamicDto = new CallbackDynamicRefundDto();
        callbackDynamicDto.setChannel(channel);
        callbackDynamicDto.setContext(reqContext);
        callbackDynamicDto.setProduct(product);
        callbackDynamicDto.setBody(body);
        callbackDynamicDto.setHeaders(headers);
        callbackDynamicDto.setParam(param);
        callbackDynamicDto.setRequestTime(requestTime);
        callbackDynamicDto.setTrade(trade);
        callbackDynamicDto.setRefundTrade(refundTrade);
        callbackDynamicDto.setRefundTradeInventory(refundTradeInventory);
        return callbackDynamicDto;
    }
}
